package com.my.ruyi.config;

import java.util.Map;

import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.reflection.wrapper.ObjectWrapper;
import org.apache.ibatis.reflection.wrapper.ObjectWrapperFactory;

/**
 * Map 类型结果转驼峰
 * @author ruyi
 *
 */
public class MybatisWrapperFactory implements ObjectWrapperFactory{

	@Override
	public boolean hasWrapperFor(Object object) {
		return object != null && object instanceof Map;
	}

	@SuppressWarnings("unchecked")
	@Override
	public ObjectWrapper getWrapperFor(MetaObject metaObject, Object object) {
		return new MybatisMapWrapper(metaObject, (Map<String, Object>) object);
	}

}
